<template>
  <ContentDetailWrap :title="t('warehouse.edit')">
    <template #header>
      <BaseButton @click="go(-1)">
        {{ t('common.back') }}
      </BaseButton>
    </template>
    <!--    表单-->
    <el-form :model="form" ref="formRef" label-width="110px">
      <div class="flex justify-between">
        <div class="w-100%">
          <Descriptions :schema="descriptionSchema" :data="form" />
        </div>
      </div>
    </el-form>
  </ContentDetailWrap>
</template>
<script setup lang="tsx">
import { ContentDetailWrap } from '@/components/ContentDetailWrap'
import { ElMessage, FormInstance } from 'element-plus'
import { getInfoApi } from '@/api/modelInfo'
import { Descriptions, type DescriptionsSchema } from '@/components/Descriptions'

const { t } = useI18n()
const { push, go } = useRouter()
const { query } = useRoute()

const loading = ref<boolean>(false)

const formRef = ref<FormInstance>()
const form = ref<Record<string, any>>({
  model_name: ''
})

const descriptionSchema = ref<DescriptionsSchema[]>([
  {
    field: 'model_name',
    label: t('modelInfo.model_name')
  },
  {
    field: 'latest_firmware_version',
    label: t('modelInfo.latest_firmware_version')
  },
  {
    field: 'firmware_url',
    label: t('modelInfo.firmware_url')
  },
  {
    field: 'operator_name',
    label: t('modelInfo.operator')
  },
  {
    field: 'create_time',
    label: t('modelInfo.create_time')
  }
])

//获取回显数据
const getBackShow = async () => {
  const resp = await getInfoApi(query.id as string)
  form.value = resp.data
}

onMounted(() => {
  getBackShow()
})
</script>
<style lang="less" scoped></style>
